package com.lightjet.macross.base.upms.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.lightjet.macross.common.core.BaseEntity;
import com.lightjet.macross.common.core.IntKeyBaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;

@Entity
@Table(name="UPMS_R_RESOURCEROLE")
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler","createDate","updateDate"})
@ApiModel(description = "角色资源关系实体类")
public class RoleResourceLink extends IntKeyBaseEntity {

    public RoleResourceLink(Integer id)
    {
        this.id = id;
    }

    public RoleResourceLink(RoleInfo roleInfo , ResourceInfo resourceInfo)
    {
        this.roleinfo = roleInfo;
        this.resourceInfo = resourceInfo;
    }

/*    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "SEQGEN_R_RESOURCEROLE")
    @SequenceGenerator(name="SEQGEN_R_RESOURCEROLE",sequenceName = "R_RESOURCEROLE_SEQ")
    @ApiModelProperty(value = "角色资源关系表主键ID")
    private Integer id;*/

    @ManyToOne
    @JoinColumn(name="roleid")
    @ApiModelProperty(value = "角色对象")
    private RoleInfo roleinfo;

    @ManyToOne
    @JoinColumn(name="resourceid")
    @ApiModelProperty(value = "资源对象")
    private ResourceInfo resourceInfo;
}
